class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table "users", :force => true do |t|
      t.column :login,                     :string
      t.column :email,                     :string
      t.column :crypted_password,          :string, :limit => 40
      t.column :salt,                      :string, :limit => 40
      t.column :created_at,                :datetime
      t.column :updated_at,                :datetime
      t.column :last_login_at,             :datetime
      t.column :remember_token,            :string
      t.column :remember_token_expires_at, :datetime
      t.column :visits_count,              :integer, :default => 0
      t.column :permalink,                 :string
      t.column :loc_changed_at,   :timestamp
      t.column :tname,        :string,    :null => false
      t.column :jabber_id,    :string

      t.column :city_id,      :integer
      t.column :latitude,     :float
      t.column :longitude,    :float
      t.column :location,     :string
      #     t.column :posex,        :integer,   :default => 0
      #     t.column :negex,        :integer,   :default => 0
    end

    add_index :users, :tname, :unique
    add_index :users, :jabber_id
    add_index :users, :city_id

  end

  def self.down
    drop_table "users"
  end
end
